<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        // 在es6中有了class这个概念
        class Houyi {
            constructor(color) {
                    this.color = color;
                }
                //constructor这个单词本身就是构造器的意思 在new一个实例的时候 constructor会自动调用

            kill() {
                alert("这是后羿的大招，这个后羿的头发颜色是" + this.color);
            }
        }
        let sundy = new Houyi("红色");
        sundy.kill();
    </script>
</body>

</html>